/**
 * 
 */
package org.restapp.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.restapp.core.XUser;
import org.restapp.service.XUserService;

/**
 * @author asudar
 * 
 */
public class XUserServiceImpl implements XUserService {

	private static List<XUser> USERS = new ArrayList<XUser>();

	public void create(XUser xUser) {
		USERS.add(xUser);
	}

	public List<XUser> getAll() {
		return USERS;
	}

	public XUser findBy(String firstName) {

		for (int i = 0; i < USERS.size(); i++) {
			XUser user = USERS.get(i);
			if (user.getFirstName().equals(firstName)) {
				return user;
			}
		}
		return null;
	}

}
